using System;
using System.Collections.Generic;
using System.Linq;
using Sustainalytics.Synchronization.Validation.ValidationRules.Common;

namespace Sustainalytics.Synchronization.Validation.Validators
{
    public class ValidationResult
    {
        public ValidationResult()
        {
            ValidationErrors = new List<ValidationFailure>();
        }

        public bool IsValid
        {
            get
            {
                return !ValidationErrors.Any();
            }
        }

        public List<ValidationFailure> ValidationErrors { get; private set; }

        public void AddError(Guid key, string errorMessage, Severity severity, BusinessResearchProduct researchProduct, string code, string comment, IEnumerable<string> triggers)
        {
            ValidationErrors.Add(new ValidationFailure(key, errorMessage, severity, researchProduct, code, comment, triggers));
        }        
    }
}